<template>
	<view>
		<view style="font-size: 20px;color: #F20;font-weight: bold;text-align: center;">
			<text style="color: #000000;">充值用户:</text>{{info.account}}
		</view>
		<view style="float: right;">
			{{info.add_time}}
		</view>
		<view style="margin-top: 50px;padding: 10px;font-size: 18px;">
				该用户的充值金额为:<text style="color: #F20;font-weight: bold;">{{info.money}}</text><br>
				充值方式为:<text style="color: #F20;font-weight: bold;">&nbsp;{{info.pay_type==1?'微信':'支付宝'}}</text>
		</view>
		<view v-if="info.state==1" style="text-align: center;font-size: 20px;color: #f20;font-weight: bold;">
			此订单已完成!
		</view>
		<view v-if="info.state==-1" style="text-align: center;font-size: 20px;color: #f20;font-weight: bold;">
			订单已失效请重新查看!
		</view>
		<view style="display: flex;justify-content: space-around;
		align-items: center;margin-top: 100px;"  v-if="info.state!=1">
			<view style="width: 80px;height: 50px;background-color: #2196F3;border-radius: 10px;font-size: 19px;color: #FFFFFF;display: flex;align-items: center;justify-content: center;" @click="uporder(info.id)">
				确定
			</view>
			<view style="width: 80px;height: 50px;background-color: #F04134;border-radius: 10px;font-size: 19px;color: #FFFFFF;display: flex;align-items: center;justify-content: center;" @tap="overorder(info.id)">
				拒绝
			</view>
		</view>
		<view v-if="inputshow" style="display: flex;flex-direction: row;align-items: center;justify-content: center;margin-top: 50px;font-size: 20px;">
			请输入退回原因:<input type="text" value="" v-model="textmodle"  placeholder="请输入拒绝原因" style="font-size: 20px;"/>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:'',
				inputshow:false,
				textmodle:''
			}
		},
		onLoad(options) {
			console.log(options)
			let data = JSON.parse(options.info);
			this.info = data;
		},
		methods: {
			uporder(id){
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/etcEdit',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data: {
						id:id,
						state:1,
					},
					success: res => {
						console.log(res)
						if(res.data.status==200){
							uni.showToast({
								title:"操作成功",
								icon:'none'
							})
							setTimeout(()=>{
								uni.navigateBack({
									
								})
							},500)
						}
					}
				})
			},
			overorder(id){
				this.inputshow = true
				if(this.textmodle==''){
					uni.showToast({
						title:"请输入退回原因",
						icon:'none'
					})
				}else{
					let token = uni.getStorageSync("token")
					uni.request({
						url: this.G_base + '/api/lz/etcEdit',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							id:id,
							state:-1,
							reject_reason:this.textmodle
						},
						success: res => {
							if(res.data.status==200){
								uni.showToast({
									title:"操作成功",
									icon:'none'
								})
								setTimeout(()=>{
									uni.navigateBack({
										
									})
								},500)
							}
							console.log(res)
						}
					})
				}
			}
		}
	}
</script>

<style>

</style>
